package m.store.model;

import m.common.model.*;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;

import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name="ts_pay_amount_record",description="付款金额记录")
public class PayAmountRecord extends Model implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.eq("pay.store.oid",storeOid))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }
    @LinkTableMeta(name="pay_oid",table= PayAmount.class,description="所属付款")
    private PayAmount pay;
    @LinkTableMeta(name="stock_oid",table= StockInfo.class,description="入库信息")
    private StockInfo stock;
    @FieldMeta(name="pay_amount",type= FieldType.DOUBLE,defaultValue = "0",description="付款金额")
    private Double payAmount;
    @FieldMeta(name = "remark",type = FieldType.STRING,length = 500,description = "备注")
    private String remark;

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public PayAmount getPay() {
        return pay;
    }

    public void setPay(PayAmount pay) {
        this.pay = pay;
    }

    public StockInfo getStock() {
        return stock;
    }

    public void setStock(StockInfo stock) {
        this.stock = stock;
    }

    public Double getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Double payAmount) {
        this.payAmount = payAmount;
    }
}
